<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
 		<title></title>
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<jsp:include page="/page/front/include.jsp"></jsp:include>
		<link rel="stylesheet" type="text/css" href="css/front/book.css" />
		<link rel="stylesheet" type="text/css" href="css/front/transaction.css" />
		<link rel="stylesheet" type="text/css" href="css/front/order_submit.css" />
		<script type="text/javascript" src="js/front/area.js"></script>
		<script language="JavaScript" type="text/javascript">
		$(document).ready(function() {
			var num = provinces.length;
			var sel_province = document.getElementById("province");
			for(var i=0; i<num; i++){
				sel_province[i] = new Option(provinces[i], provinces[i]);
			}
		});
		</script>
	</head>
	<body class="orderInfo">
		<jsp:include page="/page/front/header.jsp"></jsp:include>
		<div class="body">
			<div class="shopGuideBar"></div>
			<div class="blank"></div>
			<div class="orderInfoDetail">
				<div class="top">
					<div class="topLeft"></div>
					<div class="topMiddle">填写订单信息：</div>
					<div class="topRight"></div>
				</div>
				<form class="middle" action="settleCart.do" method="post">
					<table class="orderInfoTable">
						<tbody>
							<tr>
								<th>收货信息</th>
								<td>
									<ul>
										<li>
											<label>
											<s:if test="address==null">
												<input type="radio" id="oldAddress" name="addressRadio" disabled="disabled" class="radio" />
												<strong>使用旧地址：</strong>
												<p class="oldAddress">未填写</p>
											</s:if><s:else>
												<input type="radio" id="oldAddress" name="addressRadio" value='<s:property value="address" />' checked="checked" class="radio" />
												<strong>使用旧地址：</strong>
												<p class="oldAddress"><s:property value="formatAddress" /></p>
											</s:else>
											</label>
										</li>
										<li>
											<label>
											<s:if test="address==null">
												<input type="radio" id="newAddress" name="addressRadio" value="" checked="checked" class="radio" />
											</s:if><s:else>
												<input type="radio" id="newAddress" name="addressRadio" value="" class="radio" />
											</s:else>
												<strong>使用新地址：</strong>
											</label>
											<table id="newAddressTable" class="newAddressTable" style="display: table;">
												<tbody>
													<tr>
														<th>收&ensp;货&ensp;人：</th>
														<td>
															<input type="text" name="name" class="formText" />
															<label class="requireField">*</label>
														</td>
													</tr>
													<tr>
														<th>地&emsp;&emsp;区：</th>
														<td>
															<jsp:include page="/page/front/select_area.jsp"></jsp:include>
															<label class="requireField">*</label>
														</td>
													</tr>
													<tr>
														<th>地&emsp;&emsp;址：</th>
														<td>
															<input type="text" name="address" class="formText">
															<label class="requireField">*</label>
														</td>
													</tr>
													<tr>
														<th>邮&emsp;&emsp;编：</th>
														<td>
															<input type="text" name="zipCode" class="formText">
															<label class="requireField">*</label>
														</td>
													</tr>
													<tr>
														<th>电&emsp;&emsp;话：</th>
														<td>
															<input type="text" name="phone" class="formText">
															<label class="requireField">*</label>
														</td>
													</tr>
													<tr>
														<th>保存地址：</th>
														<td>
															<label>
																<input type="radio" name="saveAddress" value="true" checked="checked" class="radio">
																是
															</label>
															<label>
																<input type="radio" name="saveAddress" value="false" class="radio">
																否
															</label>
														</td>
													</tr>
												</tbody>
											</table>
										</li>
									</ul>
								</td>
							</tr>
							<tr>
								<td colspan="2"> </td>
							</tr>
						</tbody>
					</table>
					<div class="blank"></div>
					<table class="cartItemTable">
						<tbody>
							<tr>
								<th colspan="2">商品</th>
								<th>售价</th>
								<th>数量</th>
								<th>小计</th>
							</tr>
							<s:set name="totalQuantity" value="0"></s:set>
							<s:set name="totalCharge" value="0"></s:set>
							<s:iterator value="#session.cart">
							<tr>
								<s:set name="bookID" value="book.bookID"></s:set>
								<td class="itemImage">
									<a href='viewBook.do?id=<s:property value="#bookID" />' target="_blank">
										<img src='<s:property value="book.picPath" />'>
									</a>
								</td>
								<td class="itemTitle">
									<a href='viewBook.do?id=<s:property value="#bookID" />' target="_blank">
										<s:property value="book.title" />
									</a>
								</td>
								<s:set name="itemPrice" value="book.price"></s:set>
								<td class="itemPrice">￥<s:property value="#itemPrice" /></td>
								<s:set name="itemQuantity" value="quantity"></s:set>
								<td><s:property value="#itemQuantity" /></td>
								<s:set name="itemCharge" value="#itemPrice*#itemQuantity"></s:set>
								<td class="itemCharge">￥<s:property value="#itemCharge" /></td>
								<s:set name="totalQuantity" value="#totalQuantity+#itemQuantity"></s:set>
								<s:set name="totalCharge" value="#totalCharge+#itemCharge"></s:set>
							</tr>
							</s:iterator>
							<tr>
								<td class="info" colspan="6">
									商品共计：<span class="red"><s:property value="#session.cart.size" /></span>种
									，<span class="red"><s:property value="#totalQuantity" /></span>件
									；订单总金额：<span class="red">￥<s:property value="#totalCharge" /></span>元
									<input type="hidden" name="charge" value='<s:property value="#totalCharge" />' />
								</td>
							</tr>
						</tbody>
					</table>
					<div class="blank"></div>
					<a class="backCartItem" href="viewCart.do"><span class="icon">&nbsp;</span>返回购物车</a>
					<input type="submit" class="formButton" value="提交订单" hidefocus="true" />
					<div class="clearfix"></div>
				</form>
				<div class="bottom">
					<div class="bottomLeft"></div>
					<div class="bottomMiddle"></div>
					<div class="bottomRight"></div>
				</div>
			</div>
		</div>
		<jsp:include page="/page/front/footer.jsp"></jsp:include>
	</body>
</html>
